class Solution1 {
    public int[] exchange(int[] nums) {
        int front = 0, rear = nums.length - 1;
        while (front < rear) {
            if (nums[front] % 2 != 0) {
                front++;
                continue;
            }
            if (nums[rear] % 2 == 0) {
                rear--;
                continue;
            }
            int tmp = nums[front];
            nums[front] = nums[rear];
            nums[rear] = tmp;
        }
        return nums;
    }
}